<!DOCTYPE html>
<html>
<head>
    <title>后台</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../static/css/base.css">
    <link rel="stylesheet" href="../static/css/hw-admin.css">
    <style>
    	#infinite-sort {
    		max-height: auto;
    		overflow: hidden;
    		float: none;
    		width: 70%;
    		/*border: none;*/
    		margin-left: 6%;
    	}
        #infinite-sort .infinite-container {
            display: block;
        }
    	.mould-items > div {
    		display: none;
    	}
    	.mould-items img {
    		float: right;
    		width: 100px;
    		height: 100px;
    		margin-right: 20px;
    	}
    	.mould-items .hw-radio {
    		line-height: 100px;
    	}
    </style>
</head>
<body>

	<div class="hw-iframe"> 
        <div class="hw-header-wrapper">
            <div class="hw-header">
                <div class="hw-header__item--left">
                    新增园区
                </div> 
            </div>
        </div>


	    <form action="" method="POST" id="main-form">
    		<input type="hidden" name="garden_id" value="<?=$garden_id?>">

    		<ul class="hw-nav-tabs">
    			<li class="active" data-toggle="tab" data-target="#base-info">基本信息</li>
    			<li data-toggle="tab" data-target="#account-info">账号信息</li>
    			<li data-toggle="tab" data-target="#assignment">功能分配</li>
    			<li data-toggle="tab" data-target="#choose-mould">模板选择</li>
    		</ul>

    		<div class="hw-tab-panes">
    			<div id="base-info" class="tab-pane">
    				<!-- 基本信息 -->
    				<div class="hw-group">
    					<div class="group-title">基本信息</div>
    					<div class="group-info">
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name"><span>*</span>园区名称</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="name" value="<?=isset($garden)?$garden['name']:''?>" required>
    								</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name">法人姓名</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="legal_person" value="<?=isset($garden)?$garden['legal_person']:''?>">
    								</div>
    							</div>
    							<div class="hw-input-label">
    								<div class="name">统一信用代码</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="credit_code" value="<?=isset($garden)?$garden['credit_code']:''?>">
    								</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name">开户行</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="bank" value="<?=isset($garden)?$garden['bank']:''?>">
    								</div>
    							</div>
    							<div class="hw-input-label">
    								<div class="name">银行账号</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="bank_account" value="<?=isset($garden)?$garden['bank_account']:''?>">
    								</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name">所属地区</div>
    								<div class="form-control" style="width: 360px;">
									    <select id="province" class="hw-input smaller-size" name="province" data-value="<?=isset($garden)?$garden['province']:''?>"></select>
									    <select id="city" class="hw-input smaller-size" name="city" data-value="<?=isset($garden)?$garden['city']:''?>"></select>
									    <select id="area" class="hw-input smaller-size" name="area" data-value="<?=isset($garden)?$garden['area']:''?>"></select>
    								</div>
    							</div>
    							<div class="hw-input-label">
    								<div class="name">详细地址</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="address" value="<?=isset($garden)?$garden['address']:''?>">
    								</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name">公司邮箱</div>
    								<div class="form-control">
    									<input class="hw-input" type="email" name="email" value="<?=isset($garden)?$garden['email']:''?>">
    								</div>
    							</div>
    							<div class="hw-input-label">
    								<div class="name">固定电话</div>
    								<div class="form-control">
    									<input class="hw-input" type="text" name="phone" tel="true" value="<?=isset($garden)?$garden['phone']:''?>">
    								</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name">所属运营公司</div>
    								<div class="form-control">
    									<div class="hw-search-prevent">
	    									 <input type="text" id="company-name" class="hw-input" readonly value="<?=isset($company)?$company['company_name']:''?>">
	    									<input type="hidden" id="hidden-id" name="company_id" value="<?=isset($garden)?$garden['company_id']:0?>">
    									</div>
    								</div>
    							</div>
							</div>
							<div class="group-item">
								<div class="hw-input-label">
									<div class="name">描述信息</div>
									<div class="form-control">
										<textarea class="hw-textarea" name="description"><?=isset($garden)?$garden['description']:''?></textarea>
									</div>
								</div>
							</div>
							<div class="group-item">
								<div class="hw-input-label">
									<div class="name">图片</div>
									<div class="form-control">
										<div class="hw-img-lists" data-input-name="image">
													<div class="list">
														<img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1518345655409&di=dcd659eeea1d3ffb890b860d120e1927&imgtype=0&src=http%3A%2F%2Fimg.ycwb.com%2Fnews%2Fattachement%2Fjpg%2Fsite2%2F20160630%2F507b9d76255118deaeaa43.jpg" alt="">
														<div class="operate">
															<i class="hw-iconfont  preview-img">&#xe615;</i>
															<i class="hw-iconfont delete-img">&#xe65f;</i>
														</div>
														<div class="musk"></div>
													</div>
													<input type="hidden" name="image" value="<?=$garden['image']?>">
											<label for="img-input" class="add-img-btn" data-num="1">+</label>
											<span class="tip">(300px * 300px)</span>
										</div>
									</div>
								</div>
							</div>
    					</div>
    				</div>

			        <!-- 附件上传 -->
					<div class="hw-group">
			        	<div class="group-title">附件上传</div>
			        	<div class="group-info">
			                <div class="group-item">
			                	<div class="hw-input-label">
				                	<div class="name"></div>
				                	<div class="form-control">
				                    	<label for="file-input" class="hw-btn hw-default-btn add-attachment-btn">
							    			点击上传
							    		</label>
						    		</div>
					    		</div>
			                </div>
			                <div class="group-item">
			                    <!-- 附件列表 -->
								<div class="hw-input-label">
									<div class="name"></div>
									<div class="form-control">
										<div class="hw-file-lists" data-input-name="attachment[]">
											<?if(isset($attachment)):?>
					                        <?foreach($attachment as $key=>$value):?>
					                            <div class="list">
					                            	<div class="detail">
					                            		<div class="file-name">哈哈哈</div>
					                            		<div class="status">
					                            			<i class="hw-iconfont">&#xe650;</i>
					                            			<i class="hw-iconfont delete-file">&#xe63d;</i>
					                            		</div>
					                            	</div>
					                            	<input type="hidden" name="attachment[]" value="">
					                            </div>
					                        <?endforeach;?>
					                        <?endif;?>
										</div>
									</div>
								</div>
			                </div>
			        	</div>
			        </div>

			        <!-- 变更记录 -->
			        <?if($garden_id != 0):?>
						<div class="hw-group">
				        	<div class="group-title">变更记录</div>
				        	<div class="group-info">
				                <div class="group-item">
				                	<div class="hw-input-label">
				                		<div class="name"></div>
				                		<div class="form-control">
						                	<a class="hw-word-btn" href="<?=base_url().'Log/Log/seeLogList/enterprise/'.$garden_id?>">查看变更记录</a>
				                		</div>
				                	</div>
				                </div>
				        	</div>
				        </div>
				    <?endif;?>
    			</div>

    			<div id="account-info" class="tab-pane">
    				<!-- 管理员信息 -->
    				<div class="hw-group">
    					<div class="group-title">管理员信息</div>
    					<div class="group-info">
    						<div class="group-item">
    							<div class="hw-input-label">
	    							<div class="name"><span>*</span>姓名</div>
	    							<div class="form-control">
	    								<input type="text" class="hw-input" name="admin_name" value="<?=isset($admin)?$admin['name']:''?>" required>
	    							</div>
    							</div>
    							<div class="hw-input-label">
	    							<div class="name">性别</div>
	    							<div class="form-control">
	    								<div class="hw-radio-inline">
	    									<label class="hw-radio">
	    										<input type="radio" name="admin_sex" value="0" <?if(isset($admin)){if($admin['sex']==0){echo 'checked';}}else{echo 'checked';}?>>
	    										<span>男</span>
	    									</label>
	    									<label class="hw-radio">
	    										<input type="radio" name="admin_sex" value="0" <?if(isset($admin)){if($admin['sex']==1){echo 'checked';}}?>>
	    										<span>女</span>
	    									</label>
	    								</div>
	    							</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
	    							<div class="name">身份证号</div>
	    							<div class="form-control">
	    								<input type="text" class="hw-input" name="admin_id_card" idCard value="<?=isset($admin)?$admin['id_card']:''?>">
	    							</div>
    							</div>
    							<div class="hw-input-label">
	    							<div class="name">工号</div>
	    							<div class="form-control">
	    								<input type="text" class="hw-input" name="admin_job_number" value="<?=isset($admin)?$admin['job_number']:''?>">
	    							</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
	    							<div class="name">公司邮箱</div>
	    							<div class="form-control">
	    								<input type="email" class="hw-input" name="admin_email" value="<?=isset($admin)?$admin['email']:''?>">
	    							</div>
    							</div>
    							<div class="hw-input-label">
	    							<div class="name">联系电话</div>
	    							<div class="form-control">
	    								<input type="text" class="hw-input" name="admin_phone" phone="true" value="<?=isset($admin)?$admin['phone']:''?>">
	    							</div>
    							</div>
    						</div>
    					</div>
    				</div>

    				<!-- 账号信息 -->
    				<div class="hw-group">
    					<div class="group-title">账号信息</div>
    					<div class="group-info">
    						<div class="group-item">
    							<div class="hw-input-label">
	    							<div class="name"><span>*</span>账号抬头</div>
	    							<div class="form-control">
	    								<input type="text" class="hw-input command-head" name="head" value="<?=isset($garden)?$garden['head']:''?>" required <?if($garden_id!=0){echo 'readonly';}?>>
	    							</div>
    							</div>
    							<div class="hw-input-label">
	    							<div class="name"><span>*</span>登录账号</div>
	    							<div class="form-control">
	    								<input type="text" class="hw-input login-command" name="admin_username" value="<?=isset($admin)?$admin['username']:''?>" readonly required>
	    							</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
	    							<div class="name"><span>*</span>登录密码</div>
	    							<div class="form-control">
	    								<input type="password" id="password" class="hw-input password" name="admin_password" value="<?=isset($admin)?$admin['password']:''?>" required <?if($garden_id!=0){echo 'readonly';}?>>
	    							</div>
    							</div>
    							<div class="hw-input-label">
	    							<div class="name"><span>*</span>确认密码</div>
	    							<div class="form-control">
	    								<input type="password" class="hw-input confirm-password" name="admin_password2" value="<?=isset($admin)?$admin['password']:''?>" required <?if($garden_id!=0){echo 'readonly';}?>>
	    							</div>
    							</div>
    						</div>
    						<div class="group-item">
    							<div class="hw-input-label">
    								<div class="name">备注信息</div>
    								<div class="form-control">
    									<textarea class="hw-textarea" name="admin_note"><?=isset($admin)?$admin['note']:''?></textarea>
    								</div>
    							</div>
    						</div>
    					</div>
    				</div>
    			</div>

    			<div id="assignment" class="tab-pane">
    				<!-- 功能分配 -->
    				<div class="hw-group">
    					<div class="group-info">
    						<div class="group-item">
    							<div id="infinite-sort">
    								<div class="checkbox-inline"><label class="hw-checkbox"><input type="checkbox" class="parent"></label><i class="hw-iconfont slide-icon slide-active">&#xe619;</i><i class='hw-iconfont slide-icon'>&#xe603;</i><span>S'Park小站</span></div>
    							    <div class="infinite-container">
    							        <div class="checkbox-inline"><label class="hw-checkbox"><input type="checkbox" name="function[]" value="1" <?if(isset($garden) && in_array(1, $garden['function'])){echo 'checked';}?>></label><span>S'Park小邮局</span></div>
    							        <div class="checkbox-inline"><label class="hw-checkbox"><input type="checkbox" name="function[]" value="2" <?if(isset($garden) && in_array(2, $garden['function'])){echo 'checked';}?>></label><span>S'Park便利店</span></div>
    							        <div class="checkbox-inline"><label class="hw-checkbox"><input type="checkbox" name="function[]" value="3" <?if(isset($garden) && in_array(3, $garden['function'])){echo 'checked';}?>></label><span>园区会议室管理</span></div>
    							        <div class="checkbox-inline"><label class="hw-checkbox"><input type="checkbox" name="function[]" value="4" <?if(isset($garden) && in_array(4, $garden['function'])){echo 'checked';}?>></label><span>服务超市</span></div>
    							    </div>
    							</div>
    						</div>
    					</div>
    				</div>
    			</div>

    			<div id="choose-mould" class="tab-pane">
    				<!-- 模板选择 -->
    				<div class="hw-group">
    					<div class="group-info">
    						<div class="group-item mould-radio">
    							<div class="hw-input-label">
    								<div class="name">官网模板</div>
    								<div class="form-control">
		    							<div class="hw-radio-inline">
		    								<label class="hw-radio">
		    									<input type="radio" name="model" data-type="0" value="0" <?if(isset($garden)){if($garden['model']==0){echo 'checked';}}else{echo 'checked';}?>>
		    									<span>系统模板</span>
		    								</label>
		    								<label class="hw-radio">
		    									<input type="radio" name="model" data-type="1" value="1" <?if(isset($garden)){if($garden['model']==1){echo 'checked';}}?>>
		    									<span>网站链接</span>
		    								</label>
		    							</div>
    								</div>
    							</div>
    						</div>
    						<div class="group-item mould-items">
    							<div class="hw-input-label">
    								<div class="name"></div>
    								<div class="form-control">
		    							<label class="hw-radio">
	    									<input type="radio" name="model_id" checked <?if(isset($garden)){if($garden['model_id']==1){echo 'checked';}}else{echo 'checked';}?> value="1">
	    									<img src="/static/img/add.png" alt="">
	    								</label>
    								</div>
    							</div>
    							<div class="hw-input-label">
    								<div class="name"><span>*</span>网站链接</div>
    								<div class="form-control">
		    							<input class="hw-input" type="text" name="web_url" value="<?=isset($garden)?$garden['model']==1?$garden['web_url']:'':'';?>" required></input>
    								</div>
    							</div>
    						</div>
    					</div>
    				</div>
    			</div>

    		</div>

    		<div class="group-operate">
				<div class="hw-container">
					<a class="hw-btn hw-default-btn" href="<?=base_url().'SparkAdmin/Garden/garden_list'?>">取消</a>
					<button class="hw-btn">保存</button>
				</div>
			</div>

		</form>

	</div>
	
	<!-- 所属运营公司modal -->
    <div class="modal hide" id="companyModal">
		<div class="modal-mask"></div>
		<div class="modal-content">
			<div class="modal-header">
				<i class="iconfont" data-dismiss="modal"><i class="hw-iconfont">&#xe63d;</i></i>
				<div class="modal-title">所属运营公司</div>
			</div>
			<div class="modal-body">
				<div class="hw-search"><input class="hw-input search-input" type="text"></div>
				<div class="main-table-wrap" id="main-table-wrap">
			        <div class="main-table-content" id="main-table-content">
			            <div class="main-table-thead" id="main-table-thead">
			                <table cellspacing="0" cellpadding="0" border="0">  
			                    <colgroup>
			                        <col class="col-3">
			                        <col class="col-2">
			                        <!-- <col class="col-5"> -->
			                        <col class="col-10">
			                    </colgroup>
			                    <thead>
			                        <tr>
			                            <th>选择</th>
			                            <th>序号</th>
			                            <th class="hide">运营公司ID</th>
			                            <th>运营公司名称</th>
			                        </tr>
			                    </thead>
			                </table>
			            </div>
			            <div class="main-table-tbody" id="main-table-tbody">
			                <table cellspacing="0" cellpadding="0" border="0">  
			                    <colgroup>
			                        <col class="col-3">
			                        <col class="col-2">
			                        <!-- <col class="col-5"> -->
			                        <col class="col-10">
			                    </colgroup>
			                    <tbody>
			                    	<!-- <tr>
			                    		<td><label class="hw-radio"><input type="radio" name="company-radio" class="company-radio"></label></td>
			                    		<td>1</td>
			                    		<td class="company-id hide">2</td>
			                    		<td class="company-name">公司名称</td>
			                    	</tr> -->
			                    </tbody>
			                </table>
			            </div>
			        </div>
				</div>
				
			</div>
			<div class="modal-footer">
				<button class="hw-btn" data-dismiss="modal" data-type="0" id="modal-btn">确定</button>
				<button class="hw-btn hw-default-btn" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>

	<!-- 附件上传form表单 -->
	<form action="/Api/Upload/ajax_uploadFile" enctype="multipart/form-data" class="upload-form">
		<input type="file" name="file" id="file-input">
	</form>

	<form action="/Api/Upload/ajax_upload_img" enctype="multipart/form-data" class="upload-form">
		<input type="file" name="file" id="img-input">
	</form>

    <script src="../static/lib/jquery-1.12.4.min.js"></script>
    <script src="../static/lib/jquery.form.min.js"></script>
    <script src="../static/lib/My97DatePicker/WdatePicker.js"></script>
    <script src="../static/lib/common/util.js"></script> 
    <script src="../static/lib/common/common.js"></script>
    <script src="../static/lib/common/upload.js"></script> 
</body>
</html>